﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Expect.Core.Errors
{
    /// <summary>
    /// Error attached when an unexpected exception occur
    /// </summary>
    public class UnexpectedError: NFitError
    {
        /// <summary>
        /// The catched exception
        /// </summary>
        public string ErrorContent { get; private set; }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ex"></param>
        public UnexpectedError(Exception ex)
        {
            ErrorContent = ex.ToString();    
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="content"></param>
        public UnexpectedError(string content)
        {
            ErrorContent = content;
        }

        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        public override string ToString()
        {
            return "Unexpected error\r\n" + ErrorContent.ToString();
        }
    }
}
